package com.flume.sample

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import com.water.spout.SpoutView

/**
 *  Created by zxn on 2021/11/9.
 */
class SpoutActivity : AppCompatActivity() {

    companion object {
        @JvmStatic
        fun jumpTo(context: Context) {
            context.startActivity(Intent(context, SpoutActivity::class.java))
        }
    }

    private val spoutView by lazy {
        findViewById<SpoutView>(R.id.spoutView)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_spout)
        spoutView.let {
            it.setSpoutResource(R.mipmap.ic_spout_bg_new)
            it.show(10, 2000)
        }

        findViewById<Button>(R.id.btnBig).setOnClickListener {
            spoutView.show(1000, 2000)
        }

        findViewById<Button>(R.id.btnSmall).setOnClickListener {
            spoutView.show(500, 2000)
        }

        findViewById<Button>(R.id.btnFull).setOnClickListener {
            spoutView.show(2000, 2000)
        }

    }
}